<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="VIN号:" prop="vin">
          <el-input
            v-model="formModel.vin"
            class="filter-item filter-200"
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="模板名称:" prop="modelFileName">
          <hey-select v-model="formModel.modelFileName" filterable clearable clcd="print_model_cd"/>
        </el-form-item>
        <el-form-item class="no-warn-item" label="打印状态:" prop="printStatus">
          <hey-select v-model="formModel.printStatus" clcd="print_state_cd" />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button type="primary" v-if="hasPermission('print_task_select')" plain @click="queryList(false)">查询</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" :columns="columns" :is-select="false">

    </hey-table>

  </div>
</template>

<script>
export default {
  name: 'PrintTaskList',
  components: {

  },
  props: {},
  data() {
    return {

      formModel: {
        isDelete: '0',
        printStatus: '',
        modelFileName: '',
        vin: '',
      },
      columns: [
        { title: '任务编号', key: 'pcsgId' },
        { title: '模板代码', key: 'modelFileName'},
        { title: '模板名称', key: 'modelFileName',clcd:'print_model_cd' },
        { title: 'VIN号', key: 'vin' },
        { title: '打印状态', key: 'printStatus',clcd:'print_state_cd'},
        { title: '异常信息', key: 'printErrMsg' },
        { title: '创建时间', key: 'createTime' },
        { title: '创建人', key: 'createUsername' },
        { title: '最后修改时间', key: 'lastUpdateTime'},
        { title: '最后修改人', key: 'lastUpdateUsername' },
      ]
    }
  },
  computed: {},
  mounted() {

  },
  methods: {
    queryList() {
      this.$refs.table.query('/printQueueTbl/queryPrintQueueTbl', this.formModel, '', false)
    },
    handlePrint(row) {
      const param = {}
      param.modelFileName = row.modelFileName
      param.vin = row.vin
      this.post('/printQueueTbl/print', param).then(_ => {
        this.$info('打印任务重新发起成功!', this.queryList)
      })
    },
    handleDelete(row) {
      this.$sure('确认删除？', _ => {
        this.post('/printQueueTbl/maintainPrintQueueTbl', { pcsgId: row.pcsgId,operateType:'03'}).then(_ => {
          this.$info('删除成功', this.queryList)
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
